'''
    1 元素是否可见
    2 悬停
    3 高亮
    3


'''

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(headless=False)
    page = browser.new_page()
    page.goto('https://www.baidu.com')
    page.wait_for_timeout(2000)
    # page.screenshot(path='./baidu.png')

    res1 = page.locator('//*[@id="s-user-setting-menu"]/div/a[1]/span').is_visible()
    print(1,res1)
    # page.wait_for_timeout(2000)
    # print(2,page.locator('//*[@id="s-usersetting-top"]').is_visible())
    page.locator('//*[@id="s-usersetting-top"]').hover()
    page.locator('//*[@id="s-usersetting-top"]').highlight()
    page.wait_for_timeout(2000)
    print(2,page.locator('//*[@id="s-user-setting-menu"]/div/a[1]/span').is_visible())
    page.locator('//*[@id="s-user-setting-menu"]/div/a[1]/span').highlight()
    page.wait_for_timeout(2000)
